<% if current_user %>
<ul class="nav secondary-nav" id="userbar">
  <%
    unread_count = current_user.notifications.unread.count
    notification_class = ["notifications"]
    notification_class << "unread" if unread_count > 0
    notification_class << "active" if ["notifications"].index(params[:controller])
  %>
  <%= content_tag 'li', :class => notification_class do %>
    <%= content_tag 'a', :href => notifications_path do %>
      <span class="count"><%= unread_count %></span>
    <% end %>
  <% end %>
  <li>
    <%= link_to(current_user.login,user_path(current_user.login), :class => "dropdown-toggle")%>
    <%= render_list :class => "dropdown-menu" do |li|
      li << link_to(t("menu.my_home_page"), user_path(current_user.login) )
      unless params[:controller].match(/cpanel/)
        li << link_to(t("menu.edit_account_path"),edit_user_registration_path)
        li << link_to(t("menu.notes"), notes_path )
        li << link_to(t("menu.likes"),likes_user_path(current_user.login))
        li << link_to(t("menu.cpanel"), "/cpanel") if admin?
      end
      li << link_to(t("common.logout"), destroy_user_session_path )
    end %>
  </li>
</ul>
<% else %>
  <%= render_list :class => "nav secondary-nav", :id => "userbar" do |li|
    li << link_to( t("common.register"),new_user_registration_path)
    li << link_to( t("common.login"), new_user_session_path )
  end %>
<% end %>